package com.example.kuaizu.mapper;

import com.example.kuaizu.pojo.dto.MassageSubDTO;
import kuaizu.common.tablepojo.SubscribeMessage;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author: wangmx15
 * @date: 2025/8/24
 **/
@Mapper
public interface SubscribeMassageMapper {
    //添加订阅信息
    void addSubscribeMassage(SubscribeMessage subscribeMessage);

    //查询订阅消息情况是可以推送
    List<MassageSubDTO> selectSubscribeMassage(List<Integer> ids);

    //根据id查询未发送订阅的信息
    MassageSubDTO selectSubscribeMassageById(@Param("id") Integer id, @Param("status") Integer status);

    MassageSubDTO selectSubscribeMassageByIdAndOpenId(@Param("openid") String openId, @Param("projectId") Integer projectId, @Param("staus") Integer status);

    @Update("update subscribe_message set is_send_message = 1 where id = #{id}")
    void updateSubscribeMassageStatus(Integer id);
    @Insert("insert into mq_message_exception (mq_id,massage,status)values (#{code},#{message},#{status})")
    void insertException(@Param("code") Integer code,@Param("message") String message,@Param("status")int status);
}
